package cn.gok.io;

import java.io.*;

/**
 * @ClassName 字节流
 * @Description TODO
 * @Author HP
 * @Date 15:31 2022/7/7
 * @Version 1.0
 **/
public class 字节流 {
    public static void main(String[] args) throws IOException {
        InputStream is = new FileInputStream("D:\\workspace_idea\\javase_project\\day4\\src\\cn\\gok\\io\\a1.txt");
//        System.out.println((char)is.read());
        byte b[]=new byte[3];
        int len = 0;
        String str = null;
        while ((len=is.read(b))!=-1){
            str = new String(b,0,len);
            System.out.println(str);
        }
        is.close();
        InputStream is2 = new FileInputStream("D:\\workspace_idea\\javase_project\\day4\\src\\cn\\gok\\io\\a1");
        OutputStream os2 = new FileOutputStream("D:\\workspace_idea\\javase_project\\day4\\src\\cn\\gok\\io\\b2");
        byte b2[] = new byte[100];
        len=0;
        while ((len=is2.read(b2))!=-1){
            os2.write(b2,0,len);
        }
        os2.close();
        is2.close();

    }
}
